<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let loginList = [
        { userName: 'admin', password: 'admin321' },
        { userName: 'zs', password: 'zs321' },
        { userName: 'lisi', password: 'ls321' },
        { userName: 'yyqx', password: 'yyqx321' },
      ]
      let userInfo = {
        token1: {
          city: '杭州',
          money: '1000w',
          sex: '女',
          userName: 'admin',
          password: 'admin321',
        },
        token2: {
          city: '北京',
          money: '1100w',
          sex: '女',
          userName: 'zhangsan',
          password: 'zs321',
        },
        token3: {
          city: '北京',
          money: '800w',
          sex: '男',
          userName: 'lisi',
          password: 'ls321',
        },
        token4: {
          city: '天津',
          money: '600w',
          sex: '男',
          userName: 'yyqx',
          password: 'yyqx321',
        },
      }
      for (let i = 0; i < loginList.length; i++) {
        let token = 'token' + Math.floor(Math.random() * loginList.length) + 1
        let message = prompt('请输入用户名')
        let mm = prompt('请输入密码')
        if (message === loginList[i].userName && mm === loginList[i].password) {
          alert('登录成功')
          alert(` 此网页显示
            登录成功具体用户信息：
            city: 杭州 ,
          money: '1000w',
          sex: '女',
          userName:  ${loginList[i].userName},
            `)
        } else {
          alert('登录失败')
          while (true) {
            let num = prompt(` 请选择你的操作
              1.注册
              2.直接退出
               `)
            switch (num) {
              case '1':
                let message = prompt('请输入用户名')
                let mm = prompt('请输入密码')
                alert('你已经注册成功')

              case '2':
                break
            }
          }
        }
      }
    </script>
  </body>
</html>
